package com.jasonkurtzman.adv;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class InputHandler implements KeyListener{
	
	public boolean forward = false, backward = false, left = false, right = false;
	
	public void keyPressed(KeyEvent event)
	{
		int keyCode = event.getKeyCode();
		
		if(keyCode == KeyEvent.VK_W)
		{
			forward = true;
			System.out.println("W");
		}
		else if(keyCode == KeyEvent.VK_A)
		{
			left = true;
			System.out.println("A");
		}
		else if(keyCode == KeyEvent.VK_S)
		{
			backward = true;
		}
		else if(keyCode == KeyEvent.VK_D)
		{
			right = true;
		}
	}

	public void keyReleased(KeyEvent event)
	{
		int keyCode = event.getKeyCode();
		
		if(keyCode == KeyEvent.VK_W)
		{
			forward = false;
		}
		if(keyCode == KeyEvent.VK_A)
		{
			left = false;
		}
		if(keyCode == KeyEvent.VK_S)
		{
			backward = false;
		}
		if(keyCode == KeyEvent.VK_D)
		{
			right = false;
		}
	}

	public void keyTyped(KeyEvent event)
	{
		
	}
	
}
